home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3785 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.mindlink.net!news
  2. From: genew@mindlink.bc.ca (Gene Wirchenko)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: division problem
  5. Date: Wed, 31 Jan 1996 05:21:12 GMT
  6. Organization: MIND LINK! - British Columbia, Canada
  7. Message-ID: <4emuba$1mo@fountain.mindlink.net>
  8. References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca> <4eh246$u6h@airdmhor.gen.nz> <4ej4ha$66@fountain.mindlink.net> <DLzvGG.2rn@uns.bris.ac.uk>
  9. NNTP-Posting-Host: line349.nwm.mindlink.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. nathan@pact.srf.ac.uk (Nathan Sidwell) wrote:
  13.  
  14. >Gene Wirchenko (genew@mindlink.bc.ca) wrote:
  15. >: gumboot@airdmhor.gen.nz (Simon Hosie) wrote:
  16.  
  17. >: >celcius = (fahrenheit - 32) * 5 / 9;
  18.  
  19. >:      That's disgusting <g> as it doesn't round.  Try it with 39 deg F:
  20. >:           (39-32)*5/9 ::= 7*5/9 ::= 35/9 ::= 3
  21. >: but the actual value is 3.8... i.e. nearly 4.  If you must int, 4
  22. >: would be a better answer.
  23.  
  24. >Still no need to use floating point,
  25. >celcius = ((fahrenheit - 32) * 5 + 4) / 9
  26.  
  27.      Let's assume that you had never run across fahrenheit to celsius
  28. conversion before (because the above could just as easily be a case of
  29. converting flibbles to meeblesnauzers).
  30.  
  31.      Can you derive the ORIGINAL formula for conversion of F to C?
  32.  
  33.      If yes, how?  Because you don't know what the 4 is for.
  34.  
  35.      If no, then it's unclear code, isn't it?
  36.  
  37. [sigsnip]
  38.  
  39. Sincerely,
  40.  
  41. Gene Wirchenko
  42.  
  43. C Pronunciation Guide:
  44.      y=x++;     "wye equals ex plus plus semicolon"
  45.      x=x++;     "ex equals ex doublecross semicolon"
  46.  
  47.